package com.auxgroup.hr.front.service.personnal.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import com.auxgroup.hr.front.dao.domain.PsCBankacctPrimary;
import com.auxgroup.hr.front.dao.domain.PsPyeBankacct;
import com.auxgroup.hr.front.dao.repository.PsPyeBankacctRepository;
import com.auxgroup.hr.front.service.personnal.PyeBankacctService;

/** 
 * @author wangchangyun
 * @version 创建时间：180523 
 * 银行账号service
 */
@Service("pyeBankacctService")
public class PyeBankacctServiceImpl implements PyeBankacctService {
	
	@Autowired
	private PsPyeBankacctRepository PsPyeBankacctRepository;


	@Override
	public PsPyeBankacct getPyeBankacct(PsCBankacctPrimary bankacctPrimary) {
		List<PsPyeBankacct> ts = PsPyeBankacctRepository.findByEmplid(bankacctPrimary.getEmplid());
		return ts.isEmpty() ? null : ts.get(0);
//		return PsPyeBankacctRepository.findOne(bankacctPrimary);
	}


	@Override
	public PsPyeBankacct save(PsPyeBankacct PyeBankacct) {
		return PsPyeBankacctRepository.save(PyeBankacct);
	}

	
	@Override
	public List<PsPyeBankacct> getAll() {
		PsPyeBankacct PyeBankacct = new PsPyeBankacct();
		return PsPyeBankacctRepository.findAll(Example.of(PyeBankacct));
	}

	
}
